home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 3891 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: cs.vu.nl!sun4nl!xs4all!marketgraph!rvg
  2. From: rvg@marketgraph.xs4all.nl (Ruud van Gaal)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Need help with strings in SAS/C
  5. Keywords: Keywords: SAS C
  6. Message-ID: <0212nbs60.alamito@marketgraph.xs4all.nl>
  7. Date: Wed, 14 Feb 96 13:18:02 CET
  8. References: <4fehq5$keg@news.unicomp.net>
  9. Reply-To: rvg@marketgraph.xs4all.nl
  10. X-Newsreader: Alamito Mail and News Manager (V2.0.4 for Waffle) registered to MARKETGRAPH VISUAL AUTOMATION
  11.  
  12. In <4fehq5$keg@news.unicomp.net> rays@conline.com (Ray Schmalzl) wrote:
  13.  
  14. >    Could somebody out there help me with strings in SAS/C? I have a few 
  15. >books on C in general, but none of them cover this quite enough. I have two 
  16. >problems. The first is getting the function atoi to work right. For example:
  17. >
  18. >#include <stdio.h>
  19. >#include <stdlib.h>
  20. >void main()
  21. >{
  22. >   char CharOne, CharTwo[]="012345";
  23. >
  24. >   CharOne = getch();        // assume typing in a digit here
  25. >
  26. >   printf("%c\t",CharOne) ;
  27. >   printf("%i\n",atoi(CharOne)) ;
  28. >
  29. >   printf("%c\t",CharTwo[3]) ;
  30. >   printf("%i\n",atoi (CharTwo[3]) ;
  31.  
  32. Should be atoi(&CharTwo[3]) (the address of byte 3 of CharTwo, note that 
  33. atoi(CharTwo) is seen as atoi(&CharTwo[0]). atoi(CharOne) does not do what 
  34. you expect. It's not the Basic's ASC(CharOne) or CHR(CharOne), but atoi takes 
  35. a string (CharOne now is a char, a string is a pointer to an array of chars), 
  36. not a char.
  37.  
  38. >}
  39. >
  40. >
  41.  
  42. >The SECOND question I have is: If I have a variable in my program like:
  43. >   char MF[]="ABCDEFG";
  44. >how can I set up a watch in the Code Probe debugger that will display the 
  45. >array as CHARACTERS, and not as hex values??    
  46.  
  47. Don't know.
  48.  
  49. --
  50. Ruud van Gaal
  51. MarketGraph Visual Automation
  52. E-Mail                : rvg@marketgraph.xs4all.nl
  53. DoomShell 4.5 homepage: http://www.xs4all.nl/~jwkorver
  54. "...Works fascinates me. I could sit and watch it for hours..."
  55.  
  56.